﻿using MediatR;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.RoleCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.RoleHanders
{
    public class UserDeleteCommandHandler : IRequestHandler<RoleDeleteCommand, int>
    {
        private readonly IRoleService _roleService;
        public UserDeleteCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }
        /// <summary>
        /// 有问题的代码（添加人和添加时间，修改人，修改时间会消失）
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<int> Handle(RoleDeleteCommand request, CancellationToken cancellationToken)
        {
           
            return await _roleService.DelRole(new Roles() { roleId=request.RoleId,IsDel=true,delDate=DateTime.Now,delName="王器"});

           
            
        }
    }
}
